/**
 * Copyright (c) 2006-2007 Jinyi.lu
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of GNU LGPL license by gun.org
 * which accompanies this distribution, and is available at
 * http://gnu.feld-it.at/copyleft/lesser.html
 * 
 * Project Homepage : http://code.google.com/p/demou
 * Source Code: svn checkout http://demou.googlecode.com/svn/trunk/ demou
 * Mailing list : jinyi.lu@gmail.com
 *                stonelu@126.com
 *
 *  
 * Contributors:
 *     JinYi.Lu - initial API and implementation
 */
package cn.tworen.demou.io.flv;

import cn.tworen.demou.cmd.DataType;

/**
 * Created on  2007-1-24
 *
 * Title       : VideoData.java
 * Description : 
 * 
 * @author     : LuJinYi
 * @version    : 1.0
 * @Date       : 2007-1-24
 * History     : 
 * 
 */
public class VideoData extends AbsTag implements IVideoData{
	public enum FrameType{
		KeyFrame(1),
		InterFrame(2),
		DisposableInterFrame(3);
		public int value = 0;
		private FrameType(int value) {
			this.value = value;
		}
		public static FrameType getFrameType(int value){
			switch(value) {
			case 1:
				return KeyFrame;
			case 2:
				return InterFrame;
			case 3:
				return DisposableInterFrame;
			default:
				return null;
			}
		}
	}
	public enum CodecID{
		SorensonH263(2),
		Screenvideo(3),
		On2VP6(4),
		On2VP6WithAlphaChannel(5),
		ScreenVideoVersion2(6);
		public int value = 0;
		private CodecID(int value) {
			this.value = value;
		}
		public static CodecID getCodecID(int value){
			switch(value) {
			case 2:
				return SorensonH263;
			case 3:
				return Screenvideo;
			case 4:
				return On2VP6;
			case 5:
				return On2VP6WithAlphaChannel;
			case 6:
				return ScreenVideoVersion2;
			default:
				return null;
			}
		}
	}
	public enum VideoDataType {
		H263VIDEOPACKET(2),
		SCREENVIDEOPACKET(3),
		VP6FLVVIDEOPACKET(4),
		VP6FLVALPHAVIDEOPACKET(5),
		SCREENV2VIDEOPACKET(6);
		public int value = 0;
		private VideoDataType(int value) {
			this.value = value;
		}
		public static VideoDataType getVideoDataType(int value){
			switch(value) {
			case 2:
				return H263VIDEOPACKET;
			case 3:
				return SCREENVIDEOPACKET;
			case 4:
				return VP6FLVVIDEOPACKET;
			case 5:
				return VP6FLVALPHAVIDEOPACKET;
			case 6:
				return SCREENV2VIDEOPACKET;
			default:
				return null;
			}
		}
	}
	private FrameType frameType = null;
	private CodecID codecID = null;
	private VideoDataType videoDataType = null;
	
	public VideoData() {
		this.type = DataType.VIDEO_DATA;
	}
	/**
	 * @hibernate.property
	 * @return Returns the frameType.
	 */
	public FrameType getFrameType() {
		return frameType;
	}
	/**
	 * @param frameType the frameType to set
	 */
	public void setFrameType(int value) {
		this.frameType = FrameType.getFrameType(value);
	}
	/**
	 * @hibernate.property
	 * @return Returns the codecID.
	 */
	public CodecID getCodecID() {
		return codecID;
	}
	/**
	 * @param codecID the codecID to set
	 */
	public void setCodecID(int value) {
		this.codecID = CodecID.getCodecID(value);
		this.videoDataType = VideoDataType.getVideoDataType(value);
	}
	/**
	 * @hibernate.property
	 * @return Returns the videoData.
	 */
	public VideoDataType getVideoDataType() {
		return videoDataType;
	}
}
